package com.example.daily.data.dao

import androidx.room.*
import com.example.daily.data.entity.User
import kotlinx.coroutines.flow.Flow

@Dao
interface UserDao {
    @Insert
    suspend fun insertUser(user: User): Long

    @Query("SELECT * FROM users WHERE username = :username LIMIT 1")
    suspend fun getUserByUsername(username: String): User?

    @Query("SELECT * FROM users WHERE id = :userId")
    fun getUserById(userId: Int): Flow<User>

    @Update
    suspend fun updateUser(user: User)

    @Query("UPDATE users SET currentWeight = :weight WHERE id = :userId")
    suspend fun updateUserWeight(userId: Int, weight: Float)

    @Query("UPDATE users SET password = :newPassword WHERE id = :userId")
    suspend fun updatePassword(userId: Int, newPassword: String)
} 